package com.mxpio.erp.common.technology.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpio.erp.common.plm.entity.ProjectInfo;
import com.mxpioframework.filestorage.entity.MxpioFileInfo;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_INVENTORY_ITEM_MASS_PROD_REVIEW")
@Schema(description="产品批产评审申请单")
public class MassProductionReview extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column(name = "CODE_")
	@Schema(description = "申请单号")
	@Generator(policy = ResCodeGeneratorPolicy.class)
	private String code;

	@Column(name = "ITEM_CODE_")
	@Schema(description = "产品编码")//Item
	private String itemCode;

	@Column(name = "ITEM_NAME_")
	@Schema(description = "物料名称")
	private String itemName;

	@Column(name = "ITEM_SPEC_")
	@Schema(description = "物料规格")
	private String itemSpec;

	@Column(name = "LIFE_CYCLE_")
	@Schema(description = "生命周期")
	@Dict(dicCode="ERP_TECH_ITEM_LIFECYCLE")
	private String lifeCycle = "S";

	@Column(name = "PRO_CODE_")
	@Schema(description = "项目编码")//ProjectInfo
	private String proCode;

	/**项目名称*/
	@Column(name = "PRO_NAME_")
	@Schema(description = "项目名称")
	private String proName;

	@Column(name = "PROCESS_INSTANCE_ID_")
	@Schema(description = "流程实例ID")
	private String processInstanceId;

	@Column(name = "BPMN_STATUS_")
	@Schema(description = "审核状态")
	@Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
	private String bpmnStatus;

	/**项目经理*/
	@Column(name = "PRO_LEADER_")
	@Schema(description = "项目经理")
	@Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
	private String proLeader;

	/**计划开始时间*/
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "计划开工时间")
	@Column(name = "PLAN_START_TIME_")
	private java.util.Date planStartTime;
	/**计划结束时间*/
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Schema(description = "计划结束时间")
	@Column(name = "PLAN_END_TIME_")
	private java.util.Date planEndTime;

	@Column(name = "REMARKS_")
	@Schema(description = "评审说明")
	private String remarks;

	@Column(name = "FILE_NO_")
	@Schema(description = "附件")
	@Dict(dicCode = "fileNo", dicEntity = MxpioFileInfo.class, dicText = "fileName")
	private String fileNo;

	@Transient
	private Item item;
	@Transient
	private ProjectInfo projectInfo;
}
